#include "MsgTimer.h"
#include <sstream>
#include <string>

using namespace std;


CMsgManager *GetMsgManager()
{
    static CMsgManager MsgManager;
    return &MsgManager;
}
CMsgTimer *GetMsgTimer()
{
    static CMsgTimer MsgTimer;
    return &MsgTimer;
}

bool operator < (struct timeval l, struct timeval r)
{
	if (l.tv_sec == r.tv_sec)
		return l.tv_usec < r.tv_usec ? 1 : 0;
	else return l.tv_sec < r.tv_sec ? 1 : 0;
}

bool operator > (struct timeval l, struct timeval r)
{
	if (l.tv_sec == r.tv_sec)
		return l.tv_usec > r.tv_usec ? 1 : 0;
	else return l.tv_sec > r.tv_sec ? 1 : 0;
}


string num2str(int i)
{
        stringstream ss;
        ss<<i;
        return ss.str();
}